package edu.kaist.cs408.pof.backend.service;

import edu.kaist.cs408.pof.backend.dao.UserDaoImpl;
import edu.kaist.cs408.pof.common.model.KaistianVo;
import edu.kaist.cs408.pof.common.service.KaistianSvc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;

import javax.ws.rs.QueryParam;

/**
 * Created with IntelliJ IDEA.
 * User: duyleekun
 * Date: 5/11/12
 * Time: 1:11 AM
 * To change this template use File | Settings | File Templates.
 */
@Configurable
public class KaistianSvcImpl implements KaistianSvc {

	@Autowired
	UserDaoImpl userDao;

	@Override
	public KaistianVo create(KaistianVo newUser) {
		return userDao.createKaistian(newUser);
	}

	@Override
	public KaistianVo login(@QueryParam("username") String username, @QueryParam("password") String password) {
		KaistianVo thisUser = userDao.findKaistian(username);
		if (thisUser.getPassword().equals(password))
			return thisUser;
		else
			return null;
	}
}
